/*
 * MemotyIPPool.java Created on 27 Январь 2006 г., 3:31 To change this template, choose Tools | Template Manager and
 * open the template in the editor.
 */

package org.dicr.util.net.ippool;

import java.util.*;

import org.dicr.util.net.*;

/**
 * Memory IP Pool. Store all data in memoty.
 * 
 * @author Igor A Tarasov &lt;java@dicr.org&gt;
 * @version 060125
 */
public class MemoryIPPool extends AbstractIPPool {
	/** Allocated IPs */
	protected Set<IP> allocated = new HashSet<IP>();

	/**
     * Return allocated IPs.
     * 
     * @return allocated ips
     * @see org.dicr.util.net.ippool.AbstractIPPool#getAllocatedIps()
     */
	@Override
	public Set<IP> getAllocatedIps() {
		return new HashSet<IP>(this.allocated);
	}

	/**
     * Store allocated IPs.
     * 
     * @param ips IPs to store.
     * @see org.dicr.util.net.ippool.AbstractIPPool#sotreAllocatedIPs(java.util.Set)
     */
	@Override
	protected void sotreAllocatedIPs(Set<IP> ips) {
		this.allocated = (ips != null) ? new HashSet<IP>(ips) : new HashSet<IP>();
	}
}
